package com.study.csc.a14waitandnotify;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @author csc
 * @Date 2023/10/23 9:38
 * @PackageName:com.study.csc.a14waitandnotify
 * @ClassName: Cook
 * @Description: 厨师
 * @Version 1.0
 */
public class Cook extends  Thread{

    ArrayBlockingQueue<String> queue;


    public Cook(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }


    @Override
    public void run() {
            while (true){
                //不断的把面条放到阻塞队列当中
                try {
                    queue.put("面条");
                    System.out.println("厨师放了一碗面条");
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
    }


}
